<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户留言</title>
</head>

<body>
    <a href="/" class="button">返回</a>
    <h1>用户留言</h1>
    <form action="/message/" method="post">

         {% csrf_token %}
        <button type="submit" name="action" value="1">新增</button>
        <button type="submit" name="action" value="2">删除</button>
        <button type="submit" name="action" value="3">修改</button>
        <button type="submit" name="action" value="4">查询所有留言</button>
        <div class="container mt-5">
            <h2>修改留言</h2>
            <form action="/comment/" method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="id_email" class="form-label">留言人</label>

                    {{ form.userid.errors }}
                    {{ form.userid }}
                </div>
                <div class="mb-3">
                    <label for="id_pname" class="form-label">留言</label>
                    {{ form.kdescription.errors }}
                    {{ form.kdescription }}
                </div>
            </form>
        </div>

    {% if kdescription %}
        {% for kdescriptions in kdescription %}
            <li>
                <p><strong>留言人:</strong> {{ kdescriptions.userid }}</p>
                <p><strong>评论:</strong> {{ kdescriptions.message }}</p>
            </li>
        {% endfor %}
    {% else %}
        <p>暂无留言。</p>
    {% endif %}

    </form>
</body>

</html>